﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Globalization;


namespace IDE_WEEK2
{
    public partial class Form1 : Form
    {
        Form2 mc = new Form2();
        int count = 1;
   
        public Form1()
        {
            this.BackColor = Color.Gold;

                Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
                InitializeComponent();
        }

        private void Opennewform_Click(object sender, EventArgs e)
        {
            mc.Visible = true;
        }

        private void changeicon_Click(object sender, EventArgs e)
        {
            this.Icon = Properties.Resources.Icon1;
            mc.Icon = Properties.Resources.Icon2;
        }

        private void Reseticon_Click(object sender, EventArgs e)
        {
            this.Icon = default(Icon);
            mc.Icon = default(Icon);
        }

        private void ChangeLanguage(string lang)
        {
            foreach (Control c in this.Controls)
            {
                ComponentResourceManager resources =new ComponentResourceManager(typeof(Form1));
                resources.ApplyResources(c, c.Name, new CultureInfo(lang));
            }
        }


        private void changelanguage_Click(object sender, EventArgs e)
        {

            count++;
            if (count % 2 == 0)
            {
                this.ChangeLanguage("zh-Hans");    
            }
            else
            {
                this.ChangeLanguage("en");
            }
        }

        private void callclass1_Click(object sender, EventArgs e)
        {
            int[] numbers = new int[10];
            Class1.MakeRandomNumber(numbers);
            label1.Text = numbers[0] + ", " + numbers[1] + ", " + numbers[2];
            textBox1.Text = numbers[0] + ", " + numbers[1] + ", " + numbers[2];  
        }



    }
}
